﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Dataglot.CrossDb;
using NUnit.Framework;

namespace Dataglot.IntegrationTests
{
    [TestFixture]
    public class CreateDatabaseTests
    {
        [Test]
        public void ConnectToMaster()
        {
            ConnectToMaster con = new ConnectToMaster();
            con.GuessConnectionStringAndConnect();
            List<string> items= con.ListDbs();
            foreach(string s in items)
            {
                Debug.WriteLine(s);
            }
        }

        [Test]
        public void CreateAndDropASqlDatabase()
        {
            string dbName = "integration_test_" + Guid.NewGuid();

            ConnectToMaster master = new ConnectToMaster();
            if(master.ListDbs().Contains(dbName))
            {
                throw new InvalidOperationException("That db already exists.");
            }
            string actualName = master.AddDataBase(dbName);
            master.RemoveDataBase(actualName);
        }
    }
}
